<template>

</template>

<script>
import * as echarts from 'echarts';
export default {
  name: "LineChart",
  mounted() {
    this.initCharts()
  },
  methods: {
    initCharts() {
      $.get(this.$BaseUrl+"/asiangameCountInfo/getall",function(res){
        console.log(res);
        let all=[[],[]]
        res.forEach((value,index)=>{
          all[0].push(value['countMinproject']);
          all[1].push(value['year'])
        });
        console.log(all);

        const chartDom = document.getElementById('left-bottom');
        const myChart = echarts.init(chartDom);
        let option;

        option = {
          // title(type, callerName, filepath) {
          //   return undefined;
          // },
          title: {
            text: '历届亚运会参赛人数变化',
            subtext: '数据来源:百度百科',
            left: 'center'},

          xAxis: {
            type: 'category',
            data:all[1]
          },
          yAxis: {
            type: 'value'
          },

          series: [
            {
              data:all[0],
              type: 'line'
            }
          ]
        };
        option && myChart.setOption(option);
        window.addEventListener("resize",()=>{
          myChart.resize();
        });
      })
    }
  }

}
</script>

<style scoped>

</style>
